@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                分类列表
                
            </h1>
            <ol class="breadcrumb">
                <li><a href="/admin/cate/show"><i class="fa fa-dashboard"></i>分类列表 </a></li>
                </li>
            </ol>
        </section>
        <div class="box-header">
            {{--分页--}}
            <form action="/admin/cate/show" method="get">
                <div class="col-xs-2">
                    <div class="form-group">
                        <select name="num" class="form-control">
                            <!-- 判断num的值,并选中 -->
                            <option
                                    @if(!empty($request['num']) && $request['num'] == 10)
                                    selected
                                    @endif
                            >10</option>
                            <option
                                    @if(!empty($request['num']) && $request['num'] == 20)
                                    selected
                                    @endif
                            >20</option>
                            <option
                                    @if(!empty($request['num']) && $request['num'] == 50)
                                    selected
                                    @endif
                            >50</option>
                            <option
                                    @if(!empty($request['num']) && $request['num'] == 100)
                                    selected
                                    @endif
                            >100</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-3 col-md-offset-7">
                    <div class="input-group input-group-sm">
                        <input name="keywords" type="text" class="form-control" value="{{$request['keywords'] or ''}}">
                                <span class="input-group-btn">
                                  <button class="btn btn-info btn-flat">搜索!</button>
                                </span>
                    </div>
                </div>
            </form>
        </div><!-- /.box-header -->
        <!-- 分类添加成功 -->
        @if (session('success'))
            <div class="alert alert-success alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <h4><i class="icon fa fa-check"></i>恭喜!</h4>
                        {{ session('success') }}
            </div>
        @endif
        @if(session('info'))
            <div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <h4><i class="icon fa fa-ban"></i>警告!</h4>
                {{ session('info') }}
            </div>
        @endif
<!-- Main content -->
        <section class="content">
            <div class="row">

                    <div class="box">
                        <div class="box-header">
                        </div><!-- /.box-header -->
                        <!-- 分类列表 -->
                        <div class="box-body">
                            <table id="example2" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>分类名称</th>
                                    <th>父ID</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $v)
                                <tr>
                                    <td>{{$v -> id}}</td>
                                    <td>{{$v -> catename}}</td>
                                    <td>{{$v -> c_name}}</td>

                                    <td>
                                    @if($v -> status == 0)
                                        正常
                                    @else
                                        禁用
                                    @endif
                                    </td>

                                    <td><a href="/admin/cate/edit/{{$v -> id}}" class="btn bg-olive margin"><i class="fa fa-edit"></i></a><a href="/admin/cate/delete/{{$v -> id}}" class="btn bg-maroon margin"><i class="fa fa-trash-o"></i></a></td>
                                </tr>
                                @endforeach
                                </tfoot>
                            </table>
                            {!! $data->render() !!}
                            {{--{!! $data->appends($request)->render() !!}--}}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->


                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection
